'use strict';

module.exports = app => {
    const { STRING, UUID, UUIDV4, INTEGER, DECIMAL, DATE } = app.Sequelize;

    const model = app.model.define('visit', {
        id: {
            type: UUID,
            primaryKey: true,
            defaultValue: UUIDV4,
            comment: '主键',
        },
        customer_id: {
            type: UUID,
            comment: '客户GUID',
        },
        contact_id: {
            type: UUID,
            comment: '联系人GUID',
        },
        visit_time: {
            type: DATE,
            comment: '拜访时间'
        },
        next_time: {
            type: DATE,
            comment: '下次回访时间',
        },
        reply: {
            type: STRING,
            comment: '行动反馈',
        },
        plan: {
            type: STRING,
            comment: '行动计划',
        },
        fee: {
            type: DECIMAL,
            comment: '拜访费用'
        },
        files: {
            type: STRING,
            comment: '附件',
            defaultValue: '',
        },
        remark: {
            type: STRING,
            comment: '相关点评',
        },
        userid: {
            type: UUID,
            comment: '用户Id',
        },
    }, {
            tableName: 'visit',
            comment: '客户拜访表',
        });

    return model;
};
